//
//  ClassDetailTableViewCell.m
//  AndCampus
//
//  Created by 史宵宵 on 2017/12/12.
//  Copyright © 2017年 史宵宵. All rights reserved.
//

#import "ClassDetailTableViewCell.h"
@interface ClassDetailTableViewCell()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *payWidth;

@end
@implementation ClassDetailTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setClassRoomInfo:(ClassRoomInfo *)classRoomInfo{
    self.titleLabel.text = classRoomInfo.course_name;
    self.contentLabel.text = classRoomInfo.title;
    self.peopleLabel.text = [NSString stringWithFormat:@"%@人参与", classRoomInfo.page_viewcount];
    self.priceLabel.text = [classRoomInfo.source_price isEqualToString:@"0"]? @"免费" : [NSString stringWithFormat:@"¥%@", classRoomInfo.source_price];
    NSString *buyStr = [NSString stringWithFormat:@"%@",classRoomInfo.buyHistory];
    if ( ![buyStr isEqualToString:@"2"]) {
        self.payWidth.constant = 0;
    }else{
        self.payWidth.constant = 70;
    }
}
- (IBAction)payButton:(id)sender {
    if (self.payClassBlack) {
        self.payClassBlack(self.classRoomInfo);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
